<%@ page import="top.psjj.news.utils.StepUtils" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>评论查询</title>
	<link rel="icon" href="${pageContext.request.contextPath}/favicon.ico"  type="image/x-icon"/>
	<link href="${pageContext.request.contextPath}/style/news.css" rel="stylesheet">
	<link href="${pageContext.request.contextPath}/bootstrap/css/bootstrap.css" rel="stylesheet">
	<link href="${pageContext.request.contextPath}/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
	<script src="${pageContext.request.contextPath}/bootstrap/js/jQuery.js"></script>
	<script src="${pageContext.request.contextPath}/bootstrap/js/bootstrap.js"></script>
</head>
<body>
<div class="data_list backMain">
	<div class="dataHeader navi">
		
		当前位置：&nbsp;&nbsp;
		主页&nbsp;&nbsp;&gt;&nbsp;&nbsp;
		新闻评论管理&nbsp;&nbsp;&gt;&nbsp;&nbsp;
		新闻评论维护&nbsp;&nbsp;
	</div>
	<div class="search_content" style="vertical-align: middle;padding-right: 20px;">
		<div style="float: left;padding-top: 10px;">
			<button class="btn btn-mini btn-danger" type="button" onclick="commentsDelete()">批量删除</button>
		</div>
		<div style="float: right;">
			<form action="${pageContext.request.contextPath}/comment" method="post">
				评论日期：<input type="text" id="s_bCommentDate" name="s_bCommentDate" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="width: 100px;" value=""/>
				&nbsp;到&nbsp;<input type="text" id="s_aCommentDate" name="s_aCommentDate" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="width: 100px;" value=""/>
				&nbsp;&nbsp;<button class="btn btn-mini btn-primary" type="submit" style="margin-top: -8px;">查询</button>
			</form>
		</div>
	</div>
	<div class="data_content">
		<table class="table table-hover table-bordered">
			<tr>
				<th><input type="checkbox" id="checkedAll"/></th>
				<th>序号</th>
				<th>评论内容</th>
				<th>评论主题</th>
				<th>评论时间</th>
				<th>操作</th>
			</tr>
			<c:forEach items="${list}" var="comment" varStatus="in">
				<tr>
					<td><input type="checkbox" name="commentIds" value=""/></td>
					<td>${in.count+(currentPage-1)*pageSize}</td>
					<td>${comment.content}</td>
					<td>${comment.news.title}</td>
					<td>${comment.commentDate}</td>
					<td><button class="btn btn-mini btn-danger" type="button" >删除</button></td>
				</tr>
			</c:forEach>
		</table>
	</div>
	
	<div class="pagination pagination-centered">
  		<ul>
			<li><a href="${pageContext.request.contextPath}/comment?method=list&currentPage=1">首页</a></li>
			<li><a href="${pageContext.request.contextPath}/comment?method=list&currentPage=${currentPage-1}">上一页</a></li>
			<%
				int[] steps = StepUtils.steps((Integer)request.getAttribute("currentPage"),(Integer)request.getAttribute("pageNum"),5);
				for (int i = steps[0];i <= steps[1] ; i++){
					if((Integer)request.getAttribute("currentPage")==i){
						%>
						<li><a style ="color: #FF0000"><%=i%></a></li>
						<%
					}else {
						%>
							<li><a href="${pageContext.request.contextPath}/comment?method=list&currentPage=<%=i%>"><%=i%></a></li>
						<%
					}
				}
			%>
			<li><a href="${pageContext.request.contextPath}/comment?method=list&currentPage=${currentPage+1}">下一页</a></li>
			<li><a href="${pageContext.request.contextPath}/comment?method=list&currentPage=${pageNum}">末页</a></li>
  		</ul>
		<span>总共${count}条记录，当前${currentPage}/${pageNum}页</span>
  	</div>
</div>
</body>
</html>